package com.futureway.test.entity;

import javax.jdo.annotations.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

@Data
@ToString(exclude = { "order" })
@AllArgsConstructor
@NoArgsConstructor
@Table
@Entity
public class OrderItem {

	@Id
	@Column(length = 20)
	private String id;

	@Column(length = 100)
	private String itemName;

	@JsonIgnoreProperties(value = "items")
	@ManyToOne()
	@JoinColumn(name = "order_id", referencedColumnName = "id")
	private Order order;

	public OrderItem(String id, String itemName) {
		super();
		this.id = id;
		this.itemName = itemName;
	}

}
